package com.example.ware.exceptions;


import com.example.ware.model.responseData.ResponseData;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@ControllerAdvice
public class TokenException extends RuntimeException {



//token 为空
        @ExceptionHandler(TokenException.class)
        public ResponseEntity<String> handleTokenValidationException(TokenException ex) {
            // 捕获 TokenValidationException 异常，并返回适当的HTTP响应
            return new ResponseEntity(new ResponseData(null,false,"token为空或过期，请重新登录",201), HttpStatus.UNAUTHORIZED);
        }
    }